package SV_PERMS_WIDE;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.Set;

public class Fixed_01 {
    public static class FilePosix {
        public static void test() throws Exception {
            Path path = Paths.get("/home/ubuntu/test/posix-file.txt");
            if (!Files.exists(path)) Files.createFile(path);
            String s = "rwx------";
            Set<PosixFilePermission> perms = PosixFilePermissions.fromString(s); // Good, no defect
            Files.setPosixFilePermissions(path, perms);
        }
    }
}
